
#ifndef wu_ENTE_H
#define wu_ENTE_H

#pragma once
#include "ofMain.h"
//#include "ofxContourAnalysis.h"
#include "ofxBox2d.h"
#include "wuGrayImg.h"
#include "ofxFBOTexture.h"

class wuEnte
{
    public:
        wuEnte();
        ~wuEnte();

        virtual void setup(ofxBox2d * _box2d, int _vw, int _vh, int _initX=310, int _initY=9);
		virtual void update();
        void draw_lines();
        void draw_FBO(int _x, int _y);
		virtual void FindShape(wuGrayImg * _grayDiff);
		virtual void setPosition(int _x,int _y);
		virtual ofPoint getPosition();
		virtual bool isTouched(int _x,int _y);
		virtual void setContourAmount(int _simpleAmount);
		virtual void Touch(int _x,int _y, int forceX=300, int forceY=0);
		void myFBO_begin();
		void myFBO_end();
		void setGravity(bool _bGravity);
		void clear();
        bool drag(int _x,int _y);
        void setScrollOffset(int _scrollOff);

		// box2d
        ofxBox2d * box2d;

		// base box2D
        ofxBox2dRect base;
//        vector <ofxBox2dLine> lineStrips;
		ofxBox2dPolygon					polyLine;		  //	the box2d polygon/line shape

		int basedim;

		// openCV
		wuGrayImg 				grayDiff;
		ofxCvContourFinder		contour;
//        ofxContourAnalysis		contourAnalysis;
//        vector <ofPoint>		simpleCountour;
        float	simpleAmount;

		// Texture mix
		ofxFBOTexture myFBO;

		bool bTouched, bGravity;

		ofRectangle rect;
		ofPoint	initPos; // init position
		int vw, vh; // camera size
		ofPoint scale;
		ofPoint framePos; // kinFrameX, framePos.y; // frame position
		ofPoint shapeOff; //X, shapeOffY;
        int scrollOffset;

};
#endif

